﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;

/// <summary>
/// Summary description for ABCBook
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class ABCBook : System.Web.Services.WebService {

    public ABCBook () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string HelloWorld() {
        return "Hello World";
    }
    [WebMethod]
    public string GetProductPrice(object keyID)
    {
        DataTable dt = DataAccess.ExecuteQuery(String.Format("SELECT Price FROM Products2 WHERE ProductID = '{0}'", keyID));
        if(dt.Rows.Count > 0)
        {
            return String.Format("{0:N0}đ", dt.Rows[0][0]);
        }
        else
        {
            return "";
        }
    }
}

